win32: Always pass a window to the default event filters
authorBenjamin Otte <otte@gnome.org>
Sun, 7 Feb 2016 22:48:46 +0000 (23:48 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 11 Feb 2016 02:44:48 +0000 (03:44 +0100)
This has to happen or the event filter cannot identify what type
of display the event is from (ie if it's an XEvent, a broadway
event or a win32 MSG.

gdk/win32/gdkevents-win32.c

index 109fc550360f60086917834b0ba43123ab22b2c5..7f0a138aa22168575eaaa09dd9ef2a02b622183e 100644 (file)
@@ -936,8 +936,7 @@ apply_event_filters (GdkWindow  *window,
   GList *tmp_list;
 
   event = gdk_event_new (GDK_NOTHING);
-  if (window != NULL)
-    event->any.window = g_object_ref (window);
+  event->any.window = g_object_ref (window);
   ((GdkEventPrivate *)event)->flags |= GDK_EVENT_PENDING;
 
   /* I think GdkFilterFunc semantics require the passed-in event
@@ -1913,11 +1912,15 @@ gdk_event_translate (MSG  *msg,
 
   int i;
 
+  window = gdk_win32_handle_table_lookup (msg->hwnd);
+
   if (_gdk_default_filters)
     {
       /* Apply global filters */
 
-      GdkFilterReturn result = apply_event_filters (NULL, msg, &_gdk_default_filters);
+      GdkFilterReturn result = apply_event_filters (window ? window : gdk_screen_get_root_window (gdk_display_get_default_screen (_gdk_display)),
+                                                    msg,
+                                                    &_gdk_default_filters);
 
       /* If result is GDK_FILTER_CONTINUE, we continue as if nothing
        * happened. If it is GDK_FILTER_REMOVE or GDK_FILTER_TRANSLATE,
@@ -1927,8 +1930,6 @@ gdk_event_translate (MSG  *msg,
        return TRUE;
     }
 
-  window = gdk_win32_handle_table_lookup (msg->hwnd);
-
   if (window == NULL)
     {
       /* XXX Handle WM_QUIT here ? */